import java.util.Arrays;

/**
 * @program: data_structures_algorithms
 * @description:
 * @author: lld
 * @create: 2020-11-10 16:02
 **/
public class SelectSort1 {
    public static void main(String[] args) {
//        int[] arr={2,1,12,23,32,21,11};
//        sort(arr);
//        System.out.println(Arrays.toString(arr));
        //测试执行效率
        int[] bigArray1=new int[50000];
        for(int i=0;i<bigArray1.length;i++){
            bigArray1[i]=(int)(Math.random()*1000000);
        }
        long start = System.currentTimeMillis();
        sort(bigArray1);
        long end = System.currentTimeMillis();
        System.out.println("50000个数据排序时间(毫秒):"+(end-start));//4655
    }
    public static void sort(int[] arr){

        for(int i=0;i<arr.length-1;i++){
            for (int j = i+1; j < arr.length; j++) {
                if(arr[i]>arr[j]){
                    int temp = arr[i];
                    arr[i]=arr[j];
                    arr[j]=temp;
                }
            }

        }
    }
}
